Skip to content

Spill index receivers before jump-containing indices - #666

Open
jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/index-jump-operands-20261114
Open

jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/index-jump-operands-20261114

Conversation

@jogibear9988

@jogibear9988 jogibear9988 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Array and indexer receivers must not remain on the evaluation stack when an index jumps away. Track index jumps using the existing complex-argument metadata and reuse operand spilling.

Tests cover binary/vector/multidimensional array access, indexer getters and setters, skipped writes and compilation flags.

Validation

Full Release solution build and Standard/LightExpression native runners pass for net8.0, net10.0 and net472. net8.0: 688 TestX and 1744 legacy cases; net10.0: 688 TestX and 1745 legacy cases; net472: 669 TestX and 1610 legacy cases.

Measurements

FEC on master da14580f10fd19ae2361a8e91cfad4b2dfec182a → this change c2ccbd32fd27d6bf2423de7ea7506c1a41f39d32. Windows ARM64; .NET 8.0.28 and 10.0.9; SDK 10.0.301.

Trees, API conversions and invocation adapters are built before measurement. Compilation includes delegate creation; runtime measures the compiled delegate through the same adapter. Both sides are FEC: “System trees” names the expression API, not the System compiler.

Two opposite-load-order process rounds; seven alternating paired samples per round; medians of 14 samples, 100 ms calibration target. Verified task-local runtimes; tiered compilation disabled; each process pinned to one logical CPU. Allocations use GC.GetAllocatedBytesForCurrentThread. Slower observations are retained. Timing variation, including unchanged IL controls, prevents a blanket speedup or no-regression claim.

Runtime / API Workload Compile μs, master → patch Compile B/op Runtime ns, master → patch Runtime B/op
net10.0 / LightExpression array_assignment 14.985 → 15.817 872.1 3.897 → 3.661 0.0
net10.0 / LightExpression indexer_assignment 8.593 → 8.215 920.0 5.002 → 5.223 0.0
net10.0 / LightExpression indexer_exception_read 15.608 → 9.915 1520.0 8.065 → 6.992 0.0
net10.0 / LightExpression scalar_add 8.908 → 6.587 872.0 5.409 → 6.193 0.0
net10.0 / System trees array_assignment 8.635 → 8.433 872.0 3.081 → 3.100 0.0
net10.0 / System trees indexer_assignment 9.308 → 9.601 920.1 3.481 → 3.078 0.0
net10.0 / System trees indexer_exception_read 8.620 → 8.952 1520.1 3.855 → 3.742 0.0
net10.0 / System trees scalar_add 6.672 → 8.173 872.0 4.175 → 4.107 0.0
net8.0 / LightExpression array_assignment 5.580 → 5.494 872.0 2.040 → 2.544 0.0
net8.0 / LightExpression indexer_assignment 4.764 → 5.930 920.0 3.293 → 4.302 0.0
net8.0 / LightExpression indexer_exception_read 6.591 → 6.014 1520.0 3.932 → 4.792 0.0
net8.0 / LightExpression scalar_add 4.075 → 4.092 872.0 4.773 → 3.903 0.0
net8.0 / System trees array_assignment 8.029 → 6.952 872.0 3.212 → 4.956 0.0
net8.0 / System trees indexer_assignment 11.266 → 14.641 920.2 3.625 → 3.402 0.0
net8.0 / System trees indexer_exception_read 12.403 → 11.901 1520.2 3.149 → 2.937 0.0
net8.0 / System trees scalar_add 6.911 → 5.243 872.0 3.717 → 3.646 0.0

Shared-workload emitted IL is unchanged.

Allocation changes: none beyond measurement rounding in these shared workloads.

Affected cases without a valid master baseline

Master rejects these trees or generates a delegate with incorrect behavior, so they are excluded from comparative timings. Patch-only measurements use 14 samples, a 30 ms calibration target, and the same compilation/runtime separation. fixed_case exercises this PR’s added behavior.

Runtime / API Case Compile μs Compile B/op Runtime ns Runtime B/op
net10.0 / LightExpression fixed_case 8.002 1200.1 5.349 0.0
net10.0 / System trees fixed_case 9.037 1200.1 5.266 0.0
net8.0 / LightExpression fixed_case 5.050 1200.1 5.995 0.0
net8.0 / System trees fixed_case 7.602 1200.2 7.449 0.0

Array and indexer receivers must not remain on the evaluation stack when an index jumps away. Track index jumps using the existing complex-argument metadata and reuse operand spilling.

Tests cover binary/vector/multidimensional array access, indexer getters and setters, skipped writes and compilation flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant